﻿#region COPYRIGHT
//--------------------------------------------------------------------------------
// <copyright file="QuadTreeCollidableContainer.cs" company="starLiGHT Entertainment Studios">
//    Copyright (c) 2011
//       Roland Rosenkranz (Glatzemann@email.de)
// </copyright>
// <license>
//   This file is part of starLiGHT.Collision.
//
//   starLiGHT.Collision is free software: you can redistribute it and/or modify
//   it under the terms of the GNU Lesser General Public License as published by
//   the Free Software Foundation, either version 3 of the License, or
//   (at your option) any later version.
//
//   starLiGHT.Collision is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU Lesser General Public License for more details.
//
//   You should have received a copy of the GNU Lesser General Public License
//   along with starLiGHT.Collision. If not, see http://www.gnu.org/licenses/.
//    
//   ADDITIONAL (commercial) LICENSES for starLiGHT.Collision are available on request.
// </license>
// <version>
// **************[ starLiGHT.Engine SVN ]**********************
// * $Rev:: 3216                  $:  Revision of last commit *
// * $Author:: unknown            $:  Author of last commit   *
// * $Date:: 2011-01-11 11:05:37 #$:  Date of last commit     *
// ************************************************************
// </version>
//--------------------------------------------------------------------------------
#endregion

namespace starLiGHT.Collision.BroadPhase
{
    #region Using Statements
    using System;
    using System.Collections.Generic;
    using System.Text;
    using starLiGHT.Collections;
    #endregion

    public class QuadTreeCollidableContainer : IQuadNode
    {
        private ICollidable2D collidable;

        public QuadTreeCollidableContainer(ICollidable2D collidable)
        {
            this.collidable = collidable;
            this.collidable.Moved += new EventHandler(this.collidable_Moved);
        }

        public event EventHandler BoundsChanged;

        public RectangleF Bounds
        {
            get
            {
                return this.collidable.WorldBoundingRectangle;
            }
        }

        public ICollidable2D Collidable
        {
            get
            {
                return this.collidable;
            }
        }

        private void collidable_Moved(object sender, EventArgs e)
        {
            if (this.BoundsChanged != null)
            {
                this.BoundsChanged(this, e);
            }
        }
    }
}
